﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 大话设计模式
{
    public class PersonIterator:IIterator
    {
        PersonAggregate[] _person = new PersonAggregate[4];
        private int _index = 0;
        
        public PersonIterator(PersonAggregate[] person)
        {
            this._person = person;
        }
        public object First()
        {
            return this._person[0];
        }

        public void Next()
        {
            _index++; 
        }

        public object CurrentItem()
        {
            return _person[_index];
        }

        public bool IsDone()
        {
            return _index < _person.Length ? true : false;
        }
    }
}
